home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
ndr2.exe
/
BRETT2.C
next >
Wrap
C/C++ Source or Header
|
1993-09-02
|
4KB
|
133 lines
/****************************************************************************
The following code was taken from the Network Developer's Resource, published
by RoseWare. All contents are Copyright (c) 1993, RoseWare. All Rights
Reserved.
This material is made available as a service for subscribers of the Network
Developer's Resource. This material is not public domain. Simply put, if you
are not a subscriber of the Network Developer's Resource, you are using this
material illegally.
Those interested in subscribing should contact RoseWare via:
CompuServe: 76711,110
Internet: 76711.110@compuserve.com
Phone: (703) 799-2509
Fax: (703) 799-8041
BBS: (703) 799-2536
US Mail: P.O. Box 257
Mount Vernon, VA 22121-0257
Also see the file SUBSCRIB.TXT in this ZIP file...
Contents:
Excerpts from Brett Warthen's "A Window Into NetWare, part deux" article in the
September/October '93 issue of the Network Developer's Resource. See text for
explanation of the code.
****************************************************************************/
//////////////////////////////////////////////////////////////////////////////
HANDLE hNetWareDrv;
NetWareRequest = NULL;
hNetWareDrv = GetModuleHandle ("NETWARE");
if (hNetWareDrv != NULL) {
(FARPROC) NetWareRequest =
GetProcAddress (hNetWareDrv, "NetWareRequest");
}
///////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
BYTE NetWareCall (BYTE function_no, LPSTR request_buffer,
LPSTR reply_buffer) {
long (FAR PASCAL *NetWareRequest2) (void);
BYTE rc;
NetWareRequest2 = NetWareRequest;
ASM push ds
ASM push es
ASM mov ah,function_no
ASM lds si,request_buffer
ASM les di,reply_buffer
NetWareRequest2 ();
ASM pop es
ASM pop ds
ASM mov rc,al
return (rc);
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
int GetLoginName (LPSTR loginName) {
/* Returns 0 for success, non-zero for failure. */
long objectID;
BYTE loginTime[8];
return GetConnectionInformation (GetConnectionNumber(), loginName,
OT_USER, &objectID, loginTime);
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
#include <nwcalls.h>
int GetLoginName (LPSTR loginName) {
/* Returns 0 for success, non-zero for failure. */
NWCONN_HANDLE connectionID;
NWCONN_NUM connectionNumber;
NWOBJ_TYPE objectType;
NWOBJ_ID objectID;
BYTE loginTime[8];
NWCCODE rc;
rc = NWCallsInit (NULL, NULL);
if (rc) return rc;
rc = NWGetDefaultConnectionID (&connectionID);
if (rc) return rc;
rc = NWGetConnectionNumber (connectionID, &connectionNumber);
if (rc) return rc;
rc = NWGetConnectionInformation (connectionID, connectionNumber,
loginName, &objectType, &objectID, loginTime);
return rc;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
int GetLoginName (LPSTR loginName) {
/* Returns 0 for success, non-zero for failure. */
WORD tempWord;
char tempString[100];
int rc;
tempWord = 50;
rc = WNetGetUser (loginName, &tempWord);
if (rc) *loginName = 0;
return !*loginName;
}
////////////////////////////////////////////////////////////////////////